package org.lanqiao.tjut.test;

import org.junit.Test;
import org.lanqiao.tjut.orm.Student;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringTestDriver {
	@Test
	public void testSpring01() {
		// 获取spring 容器的上下文对象
		// create and configure beans
		ApplicationContext context = new ClassPathXmlApplicationContext("applicationConfigure.xml");
		// 从spring容器的上下文中获取 指定的 bean对象
		Student stu = (Student) context.getBean("StudentBean");
		// 输出获取的spring bean对象的内容
		System.out.println("从spring容器获取的bean对象的内容：" + stu.toString());

		System.out.println("------------------------");
		Student stu1 = (Student) context.getBean("StudentBean");
		System.out.println("从spring容器中先后取出的两个bean对象 == 判定结果:" + (stu == stu1));
	}
}
